package com.mashiguang.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.mashiguang.po.User;

public class UserDaoImpl extends HibernateDaoSupport implements UserDao {

	public User get(Integer id) {
		return getHibernateTemplate().get(User.class, id);
	}
	
	public User getUserByUsername(String username) {
		
		List<User> users = getHibernateTemplate().find(
				"from User where username = ?", 
				username);
		
		return users.get(0);
	}

}
